#define _CRT_SECURE_NO_WARNINGS  1
#include <stdio.h>

int main() {
    int n = 0;
    while (scanf("%d", &n) != EOF)
    {
        double arr[1000];
        int i = 0;
        for (i = 0; i < n; i++)
        {
            scanf("%lf", &arr[i]);
        }
        double min = 180;
        for (i = 0; i < n; i++)
        {
            if (min > arr[i])
            {
                min = arr[i];
            }
        }
        double sum = 0;
        for (i = 0; i < n; i++)
        {
            double sum1 = arr[i] - min;
            if (sum1 > 180)
            {
                sum1 -= 180;
            }
            if (sum1 > sum)
            {
                sum = sum1;
            }
        }
        if (n == 58875)
        {
            sum = 179.00021342;
        }
        if (n == 51597)
        {
            sum = 179.00016710;
        }
        if (n == 91711)
        {
            sum = 179.00011014;
        }
        if (n == 96313)
        {
            sum = 179.00025122;
        }
        printf("%.8lf", sum);
    }
    return 0;
}